package org.kunlong.qgen.domain;

import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;

public class QuestionHolder {

	public Map<QuestionType, List<AbstractQuestion>> getMap() {
		return map;
	}

	public void setMap(Map<QuestionType, List<AbstractQuestion>> map) {
		this.map = map;
	}

	private Map<QuestionType, List<AbstractQuestion>> map = new HashMap<QuestionType, List<AbstractQuestion>>();

	public synchronized void add(QuestionType type, AbstractQuestion question) {
		if (!map.containsKey(type)) {
			// if there is no key
			map.put(type, new LinkedList<AbstractQuestion>());
		}
		map.get(type).add(question);
	}
}
